package PTA;
class Complex {
    double a;
    double b;
    public Complex(double a,double b) {
        this.a = a;
        this.b = b;
    }

    public Complex add(Complex c) {
        Complex tmp = new Complex(this.a,this.b);
        tmp.a+=c.a;
        tmp.b+=c.b;
        return tmp;
    }
    public Complex sub(Complex c) {
        Complex tmp = new Complex(this.a,this.b);
        tmp.a-=c.a;
        tmp.b-=c.b;
        return tmp;
    }

    public String getString() {
        return "("+a+","+b+"i)";
    }
}
public class t5 {
    public static void main(String args[]){
        Complex c1=new Complex(3,4);
        Complex c2=new Complex(1,2);
        System.out.println("c1="+c1.getString()+",c2="+c2.getString());
        System.out.println("c1+c2="+c1.add(c2).getString());
        System.out.println("c1-c2="+c1.sub(c2).getString());
    }
}
